using System;
using System.Collections.Generic;
using System.Text;

namespace SBPweb.Modules.Modularity
{
	/// <summary>
	/// Class of ModuleGroup
	/// </summary>
	public class ModuleGroup
	{
		#region Private members

		private string pModuleGroupName;
		private List<ModuleInfo> pItems;

		#endregion

		#region Constructor logic

		/// <summary>
		/// Initializes a new ModuleGroup instance
		/// </summary>
		/// <param name="moduleGroupName">Parameter for the name of the modulegroup</param>
		public ModuleGroup(string moduleGroupName)
		{
			pModuleGroupName = moduleGroupName;
			pItems = new List<ModuleInfo>();
		}

		#endregion

		#region Public properties

		/// <summary>
		/// Returns the name of the modulegroup
		/// </summary>
		public string ModuleGroupName
		{
			get
			{
				return pModuleGroupName;
			}
			set
			{
				pModuleGroupName = value;
			}
		}

		/// <summary>
		/// Returns the ModulInfo items of the modulegroup
		/// </summary>
		public List<ModuleInfo> Items
		{
			get
			{
				return pItems;
			}
		}

		#endregion

		#region Public methods

		/// <summary>
		/// Returns a ModuleInfo item by its name
		/// </summary>
		/// <param name="moduleTypeName">Name of the ModuleInfo item</param>
		/// <returns>ModuleInfo</returns>
		public ModuleInfo GetItemByName(string moduleTypeName)
		{
			foreach (ModuleInfo mi in pItems)
			{
				if (moduleTypeName == mi.ModuleDescriptor.ModuleTypeName)
				{
					return mi;
				}
			}
			return null;
		}

		#endregion

	}
}
